Excel Sheet WaterMark

Hello Falk's,

I would like to implement a watermark after a Excel sheet was created by Doors OLE Interface. But, how?

Does anyone have an idea? Background picture?

STB

 

 


Molgy - Thu Dec 05 10:29:27 EST 2013

Re: Excel Sheet WaterMark
Scaramouch - Thu Feb 27 03:55:31 EST 2014

Hallo Falk's,

 

I got a solution. But there is a tiny mistake included.

 

string sFile = doorsHome "\\lib\\dxl\\... "


    // set water mark on display..
    clear( args )
    put( args, sFile )
    oleMethod( objSheet, "SetBackgroundPicture", args )

    // get page setup..
    oleGet( objSheet, cPropertyPageSetup, objPageSetup )
    oleGet( objPageSetup, "CenterHeaderPicture", objPicHeader )
    oleGet( objPageSetup, "CenterFooterPicture", objPicFooter )

    // set watermark to page headers.. available for printout
    olePut( objPicHeader, "Filename", sFile )
    olePut( objPicHeader, "Height", 780.75 )  // 624.75    780.75
    olePut( objPicHeader, "Width",  734.25 )  // 587.25    734.25

    // set watermark to page footer.. available for printout
    olePut( objPicFooter, "Filename", sFile )
    olePut( objPicFooter, "Height", 780.75 )  // 624.75    780.75
    olePut( objPicFooter, "Width",  734.25 )  // 587.25    734.25

Please be so kind to test this. No error messages. But the PicFooter part will not work.

If you will run the following excel macro, the watermark at the footer will be placed:

Sub InsertPicture()
 
 With ActiveSheet.PageSetup.CentertFooterPicture
 .FileName = "C:\Sample.jpg"
 .Height = 275.25
 .Width = 463.5
 .Brightness = 0.36
 .ColorType = msoPictureGrayscale
 .Contrast = 0.39
 .CropBottom = -14.4
 .CropLeft = -28.8
 .CropRight = -14.4
 .CropTop = 21.6
 End With
 
 ' Enable the image to show up in the center footer.ActiveSheet.PageSetup.CenterFooter = "&G"
 
End Sub

Does anyone have an idea?

STB